package compare;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Properties;

public class Config
{	   
    private Properties _properties;
  
    public Config(String fileName) {

    	File file = new File(fileName);
		_properties = new Properties();
		try {
			_properties.load(new FileInputStream(file));
		}
		catch(FileNotFoundException e) {
			System.err.format("Caught Exception: %s", e.toString());
			System.exit(-1);
		}
		catch(IOException e)
		{
			System.exit(-1);
		}
    }
    
    public String getString(String name) {
    	return _properties.getProperty(name);
    }
    
    public ArrayList<File> getSampleDirectories() {
    	
    	ArrayList<File> sDir = new ArrayList<File>();
    	sDir.add(new File(getString("IrisSamples01")));
    	return sDir;
    }
    
    public String getFileFormat(String path) {
    	
    	if (getString(path).equals("IrisSamples01")) {
    		return "jpg";
    	}
    	else {
    		return null;
    	}
    }
    
    public HashMap<String, String> getPropertyNames() {
    	
    	HashMap<String, String> pNames = new HashMap<String, String>();
    	pNames.put("BinUSIT", "Path to directory containing USIT binaries");
    	pNames.put("BinJBigEnc", "Path to directory containing jbig2enc binaries");
    	pNames.put("IrisSamples01", "");
    	pNames.put("IrisCodesDir", "");
    	pNames.put("Segmentations", "");
    	pNames.put("CompressedFilesBZip2", "");
    	pNames.put("CompressedFilesGZip", "");
    	pNames.put("CompressedFilesJBig2", "");
    	pNames.put("CompressedFilesXZ", "");
    	pNames.put("CompressedFilesZIP", "");
    	return pNames;
    }
}
